/*

 OPENGL TESTS
 
 */

//Import Statements
import processing.opengl.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
import java.nio.FloatBuffer;
import msafluid.*;
import fullscreen.*;
import com.sun.opengl.util.j2d.*;
import com.sun.opengl.util.texture.*;

//Global Declerations
TileSystem tileSystem;
boolean snap = true;
/* MSA Stuff */
/*final float FLUID_WIDTH = 100;
 float invWidth, invHeight;
 float aspectRatio, aspectRatio2;
 MSAFluidSolver2D fluidSolver;
 ParticleSystem particleSystem;
 BlockSystem blockSystem;
 PImage imgFluid;
 boolean drawFluid = true;*/

void setup() {
  size(500,500,OPENGL);
  background(0);
  hint(ENABLE_OPENGL_4X_SMOOTH);

  tileSystem = new TileSystem();
}

void draw() {
  tileSystem.updateAndDraw();

  if(mousePressed) {
    if(tileSystem.onTile()) {
      int i = tileSystem.getTile();
      tileSystem.tiles[i].move(mouseX,mouseY);
    }
  }
}

void mouseReleased() {
  int i = tileSystem.getTile();
  if(snap) {
    if(tileSystem.inFrame()) {
      float[] pos = new float[2];
      pos = tileSystem.getFrame();
      tileSystem.tiles[i].move(pos[0],pos[1]);
    }
  }
}

void mouseClicked() {
  //ballSystem.addBall();
}

void keyPressed() {
}

